/*******************************************OVERVIEW*******************************************************
 
 Political Fear and Loathing on Wall Street
 
 Replication do file
 
Figure 4: Probability of Trump Victory -- 2016 U.S. Presidential Election
 
 Version July 9 2023 
 
  
********************************************************************************************************************/

clear
set more off
#delimit ;


/*Set Directory -- You will need to adjust this line of code accordingly */; 


cd "/Users/ssaiegh/Files/Mac/VIX/VIX/";

/*Create Log File*/;

log using "Figure 4", replace text;


/*Load Data File*/;

use "figure_4.dta";


/*Declare Time Series*/;


tsset case;


/* Use One-Step Binomial Pricing Framework to Calculate Trump Winning Probability (Appendix C)*/;


gen time=30/365;
gen exp=exp(time*irate);
gen vix_2=vix/100;
gen up=exp(vix_2*sqrt(time));
gen down=exp(-vix_2*sqrt(time));
gen p_clinton=(exp-down)/(up-down);
gen p_trump=1-p_clinton;


/*Generate Figure 4*/;

gen trump_options=p_trump*100;

tsline trump_options trump_polls;

tsline trump_options trump_iowa if trump_iowa!=.;

log c;
